import logger = require('winston')
const app = require('./app')
const port = app.get('port')
const server = app.listen(port)

process.on('unhandledRejection', (reason: any, p: any) =>
  logger.error('Unhandled Rejection at: Promise ', p, reason)
)

server.on('listening', () =>
  logger.info(`Feathers application started on ${app.get('host')}:${port}`)
)

// import Rx = require('rxjs')
// var observable = Rx.Observable.interval(100).throttle(1000);
// var subscription = observable.subscribe(x => console.log(x));

// var subject = new Rx.Subject();
// subject.subscribe({
//   next: (v: any) => console.log('observerA: ' + v)
// });
// subject.subscribe({
//   next: (v: any) => console.log('observerB: ' + v)
// });
// subject.next(1)
// subject.next(2)
// subject.next(3)

// var many = Rx.Observable.range(1, 100);
// var lastThree = many.takeLast(1);
// many.subscribe(x => console.log(x));